﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Threading;
using Hi_Baidu.ProcessModel;

namespace Hi_Baidu.Timer
{
    class GetFriendByGroup_TimeOutEvent : TimeOutEvent
    {
        private byte[] username;
        private byte[] ItemId;

        public GetFriendByGroup_TimeOutEvent(byte[] username, byte[] ItemId, String Key, int Interval, int TryCount) 
            : base(Key, Interval, TryCount)
        {
            this.username = username;
            this.ItemId = ItemId;
            this.OnTick += new EventHandler<EventArgs>(GetFriendByGroup_TimeOutEvent_OnTick);
            this.OnTryFull += new EventHandler<EventArgs>(GetFriendByGroup_TimeOutEvent_OnTryFull);
        }

        void GetFriendByGroup_TimeOutEvent_OnTick(object sender, EventArgs e)
        {
            //重试获取操作
            GetInfomationModel.GetUserFriendByItemId(username, ItemId);
        }

        void GetFriendByGroup_TimeOutEvent_OnTryFull(object sender, EventArgs e)
        {
            System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new PUBLIC_DELEGATE(Globle.ShowWindow));
        }
    }
}
